package com.cq.hd.task.web.job;

import com.cq.hd.member.api.TbBusinessApi;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class BusinessTask {
    @Autowired
    private TbBusinessApi businessApi;

    /**
     * 扫描商家待支付补贴记录，扣减商家补贴账户余额
     */
    // 每隔 1h 扫描一次 0 0 */ * * ?
    @XxlJob("scanBusinessSubsidyBill")
    public void scanBusinessSubsidyBill() {
        log.info("扫描商家待支付补贴记录，扣减商家补贴账户余额=====>开始");
        businessApi.scanSubsidyWaitPayJob();
        log.info("扫描商家待支付补贴记录，扣减商家补贴账户余额=====>结束");
    }

    /**
     * 扫描商家补贴待转账记录，调汇付接口进行转账
     */
    // 每隔 1h 扫描一次 0 0 */ * * ?
    @XxlJob("scanSubsidyWaitTransferJob")
    public void scanSubsidyWaitTransferJob() {
        log.info("扫描商家补贴待转账记录，调汇付接口进行转账=====>开始");
        businessApi.scanSubsidyWaitTransferJob();
        log.info("扫描商家补贴待转账记录，调汇付接口进行转账=====>结束");
    }
}
